<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="telephone=no" name="format-detection" />
    <title>每日银票</title>
    <script type="text/javascript" src="{{asset('/mobile/js/jquery-1.8.3.min.js')}}"></script>
</head>
<style type="text/css">
html,body{
    width:100%;
    margin:0;
    padding:0;
}
.box{
   width: 100%;
   background: no-repeat;
   background-size: 100%;
}
.background{
    width: 100%;
    position: relative;
    pointer-events: none;
}
.btn-img{
  width:100px;
  position: absolute;
  float: left;
  top:55%;
  left:38%;
}
.control-box img:hover{
  transform: matrix(1.04,0,0,1.04,0,0);
  transition: all .5s ease-out;
}
</style>
<body>
<div class="box">
    <img class="background" src="http://user.leyougame.cc/image/01.png">
    <div class="control-box">
      @if(!$is_take)
        <img class="btn-img btn-control" src="http://user.leyougame.cc/image/do.png">
      @else
        <img class="btn-img btn-lose-control" src="http://user.leyougame.cc/image/done.png">
      @endif  
    </div>
</div>
</body>
<script type="text/javascript">

    $(".btn-control").click(function(){
      forbidSubmit();
          $.ajax({
              type: "get",
              dataType: "json",
              url: '/mobile/ticket/take/{{$user->id}}',
              data: {
                  count: 1
              },
              success: function (data) {
                if (data.flag) {
					alert("恭喜您，领取成功!");
					$(".control-box").on("click", ".btn-lose-control", function(){
						alert("每天只能领取一次，请明日再来!");
					});
                }
              }
          }); 
    });

    function forbidSubmit() {
      $(".btn-control").attr('src', 'http://user.leyougame.cc/image/done.png');
      $(".btn-img").removeClass('btn-control');
      $(".btn-img").addClass('btn-lose-control');
    }

    $(".btn-lose-control").click(function(){
		alert("每天只能领取一次，请明日再来!");
    });


</script>
</html>